import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import AutoImport from 'unplugin-auto-import/vite'

import { fileURLToPath, URL } from 'node:url'
// import vue from '@vitejs/plugin-vue'
// import vueDevTools from 'vite-plugin-vue-devtools'
 
export default defineConfig({
    plugins: [
        uni(),        
        // 自动导入配置
        AutoImport({
            imports:[
                // 预设
                'vue',
                'uni-app'                
            ]
        })
    ],
	  server: {
		    proxy: {
		      '/api': {
		        target: 'http://localhost:8081',
		        changeOrigin: true,
		        secure: false,
		        rewrite: (path) => path.replace(/^\/api/, '')
		      }
		    }
		  }
})
